package top.tenebrous.yzl.model.request;

import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.extern.slf4j.Slf4j;
import top.tenebrous.yzl.context.BaseRequest;
import top.tenebrous.yzl.context.JesticTask;
import top.tenebrous.yzl.enums.TaskStatus;

import java.io.Serializable;

@Slf4j
@EqualsAndHashCode(callSuper = true)
@Data
public class JestcSechubRequst extends JesticTask implements BaseRequest, Serializable {

    private String serverId;
    private String serverName;
    private String instanceId;
    private String token;
    private String pwd;
    private Integer type;


    @Override
    public void start() {
        super.start();
    }

    @Override
    public void end() {
        if (TaskStatus.TERMINATED != getStatus()) {
            log.info("任务[{}]已经结束...", getSeqId());
            return;
        }
        setApplyTime(System.currentTimeMillis()); ;
        setStatus(TaskStatus.RUNNING);
        log.info("任务[{}]完成...", getSeqId());
    }

    @Override
    public Long getTime() {
        return 0L;
    }

    @Override
    public void modifyNode() {
        super.updateNode(null);
    }
}
